package com.shr.code_interview;

public class Solution_20 {
	int point ; 
    public boolean isNumeric(char[] str) {
    	point = 0;
        boolean numeric = isInteger(str) ;
        if( point < str.length && str[point] == '.'){
        	point++;
        	numeric = isUnsignInteger(str) || numeric;
        }
        if(point < str.length && (str[point] == 'E' || str[point] == 'e')){
        	point++;
        	numeric = numeric && isInteger(str);
        }
        return numeric && (point == str.length) ;
     }

	private boolean isInteger(char[] str) {
		if(point < str.length && (str[point] == '+' || str[point] == '-'))
			point ++ ;
		return isUnsignInteger(str) ;
	}

	private boolean isUnsignInteger(char[] str) {
		int before = point;
		while (point < str.length && str[point] >= '0' && str[point]<='9')
			point++;
		return point > before;
	}
}
